import fs from 'fs';
import path from 'path';

export async function getPackageDependencies() {
    try {
        const packageJsonPath = path.resolve(process.cwd(), 'package.json');
        const packageJsonData = await fs.promises.readFile(packageJsonPath, 'utf8');
        const packageJson = JSON.parse(packageJsonData);

        return {
            dependencies: packageJson.dependencies || {},
            devDependencies: packageJson.devDependencies || {}
        };
    } catch (error) {
        console.error('Error reading package.json:', error);
        throw error;
    }
}